1. #define F_CPU 16000000UL
  2. #include <avr/io.h>
  3. #include <avr/interrupt.h>
  4. /******************************************************************************/
  5. int main(void)
  6. {
  7. cli();
  8. DDRD &= ~_BV(DDD0); // set as input
  9. PORTD |= _BV(PORTD0); // enable pull-up
  10. DDRB |= _BV(DDB5);
  11. PORTB |= _BV(PINB5); // initialize to high
  12. #if 0
  13. PCICR |= _BV(PCIE2); // set PCIE2 to enable PCMSK2 scan
  14. PCMSK2 |= _BV(PCINT16); // set PCINT16 to trigger an interrupt on state change
  15. #endif
  16. sei(); // turn on interrupts
  17. while (1) asm volatile ("nop"::);
  18. }
  19. /******************************************************************************/
  20. ISR (PCINT1_vect) {}
  21. /******************************************************************************/